package cn.lsc.web.controller;

import cn.lsc.result.JSONResult;
import cn.lsc.service.IVerifyCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/*
* 图形验证码接口
* */
@RequestMapping("/verifycode")
@RestController
public class VerifyCodeController {
    @Autowired
    private IVerifyCodeService iVerifyCodeService;

    @GetMapping("/imageCode/{imageCodeKey}")
    public JSONResult getVerifyCode(@PathVariable(value = "imageCodeKey") String imageCodeKey){
        try {
            String baseStr=iVerifyCodeService.getVerifyCode(imageCodeKey);
            return JSONResult.success().setData(baseStr);
        } catch (Exception e) {
            e.printStackTrace();
            return JSONResult.error();
        }
    }

//    @PostMapping("/smsCode")
//    public JSONResult smsCode(@RequestBody Map<String,String> map){
//        try {
//            iVerifyCodeService.smsCode(map);
//            return JSONResult.success();
//        }  catch (Exception e) {
//            e.printStackTrace();
//            return JSONResult.error();
//        }
//    }
//    @PostMapping("/binderSmsCode")
//    public JSONResult binderSmsCode(@RequestBody Map<String,String> map){
//        try {
//            iVerifyCodeService.binderSmsCode(map);
//            return JSONResult.success();
//        }  catch (Exception e) {
//            e.printStackTrace();
//            return JSONResult.error();
//        }
//        }
    }


